<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    div {
      width: 200px;
      height: 200px;
      padding: 20px;
      border: 20px solid #333;
      margin: 20px;

      background-color: skyblue;
      background-clip: content-box;

      box-sizing: border-box;

      /* 加上上面两个  宽高 120*120 */
      /* offsetwidth = 120+20+20+20+20 = 200 */
      /* clientwidth = 120+20+20+ = 160 */
      /* height 也是一样的  */



      /* display: none; */
      /* visibility: hidden; */
      float: left;
    }
  </style>
</head>
<body>

  <div></div>
   <script>
        var divEle = document.getElementsByTagName('div')[0];
        console.log(divEle);
        console.log('offsetWidth',divEle.offsetWidth); 
        console.log('offsetHeight',divEle.offsetHeight);

        console.log('clientWidth',divEle.clientWidth);
        console.log('clientHeight',divEle.clientHeight);


   </script>
</body>
</html>